package GUI;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.border.Border;

public class JocuriPanel {
	/**
	 * 
	 */
	PuzzleCommand buttonPuzzle;
	LupCapraVarzaCommand buttonLCV;
	CanaCommand buttonCana;
	JPanel panel;

	JPanel JocuriPanelConstr(JPanel pan) {
		panel=pan;
		
		JTabbedPane pane=new JTabbedPane();
		pane.setBounds(10, 10, 250, 400);
		
		Border border = BorderFactory.createLineBorder(Color.blue);
		Border borderPane =BorderFactory.createTitledBorder(border, "Alege un Joc");
		pane.setBorder(borderPane);
		
		//create button puzzle
		Border redline = BorderFactory.createLineBorder(Color.red);
		buttonPuzzle = new PuzzleCommand();
		buttonPuzzle.setBounds(20, 70, 150, 40);
		buttonPuzzle.setBorder(redline);
		buttonPuzzle.addActionListener(new Action());
		panel.add(buttonPuzzle);
		//create button lup capra varza
		buttonLCV = new LupCapraVarzaCommand();
		buttonLCV.setBounds(20, 160, 150, 40);
		buttonLCV.setBorder(redline);
		buttonLCV.addActionListener(new Action());
		
		panel.add(buttonLCV);
		//create button cana
		buttonCana = new CanaCommand();
		buttonCana.setBounds(20, 250, 150, 40);
		buttonCana.setBorder(redline);
		buttonCana.addActionListener(new Action());
		panel.add(buttonCana);
		
		panel.add(pane);
//		panel.setBounds(5, 10, 400, 380);
		return panel;

	}
	class Action implements ActionListener
    {
		@Override
		public void actionPerformed(ActionEvent e) {
			if(e.getSource()==buttonPuzzle)
				buttonPuzzle.execute();
			if(e.getSource()==buttonLCV)
				buttonLCV.execute();
			if(e.getSource()==buttonCana)
				buttonCana.execute();
			
		}
}
}
